<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"  content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="/tp/Public/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="/tp/Public/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/tp/Public/css/style.css"/>

</head>
<body>
<div id="container">
    <!---->
    <nav id="header" class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#"><b>BBS</b></a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li id="tab_1">
                    <a href="<?php echo U('Article/index');?>"><b>首页</b></a>
                </li>
                <li id="tab_2">
                    <a href="<?php echo U('Sort/index');?>"><b>分类</b></a>
                </li>
                <li id="tab_3">
                    <a href="<?php echo U('User/index');?>"><b>会员</b></a>
                </li>
                <?php if($_SESSION['uid']!= null): ?><li id="tab_4">
                        <a href="<?php echo U('Article/add');?>"><b>发表</b></a>
                    </li><?php endif; ?>

            </ul>
            <form class="navbar-form navbar-left" role="search" action="<?php echo U('Index/search');?>" method="get">
                <div class="form-group">
                    <input type="text" class="form-control" name="keyword" placeholder="Search">
                </div>
            </form>
            <?php if($_SESSION['uid']== null): ?><ul class="nav navbar-nav navbar-right">
                    <li  id="tab_7">
                        <a href="<?php echo U('User/login');?>">
                            <b>登录</b>
                        </a>
                    </li>
                    <li id="tab_8">
                        <a href="<?php echo U('User/rigister');?>"><b>注册</b></a>
                    </li>
                </ul><?php endif; ?>
            <?php if($_SESSION['uid']!= null): ?><ul class="nav navbar-nav navbar-right">
                    <li id="tab_5">

                        <a href="<?php echo U('notice/index');?>">
                            <i class="icon-envelope"></i>
                            <span id="">1</span>
                        </a>
                    </li>
                    <li class="dropdown" id="tab_6">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <b><?php echo (session('uid')); ?></b>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <a href="<?php echo U('User/info');?>"><b>个人网页</b></a>
                            </li>
                            <li>
                                <a href="<?php echo U('Home/User/set');?>"><b>设置</b></a>
                            </li>
                            <?php if($_SESSION['uid']== root): ?><li>
                                    <a href="<?php echo U('Home/Admin/index');?>"><b>后台管理</b></a>
                                </li><?php endif; ?>
                            <li class="divider"></li>
                            <li>
                                <a href="<?php echo U('User/logout');?>"><b>退出</b></a>
                            </li>
                        </ul>
                    </li>
                </ul><?php endif; ?>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
</nav>

    <!---->
    <div id="main" class="container">
        <div class="row">
            <div class="col-md-8">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><b>欢迎访问BBS社区</b></h3>
                    </div>
                    <div class="panel-body">
                        <ul class="media list-group">
                            <?php if(is_array($articles)): foreach($articles as $key=>$article): ?><li class="list-group-item">
                                    <a class="media-left" href="<?php echo U('User/info',array('id'=>$article['author_id']));?>">
                                        <img src="/tp/Public/images/<?php echo ($article['avatar_name']); ?>" alt="作者"
                                             style="width:50px;height: 50px ;">
                                    </a>

                                    <div class="media-body">
                                        <h3 class="media-heading topic-list-heading">
                                            <span><i class="icon-screenshot icon"></i></span>
                                            <span><a href="<?php echo U('Article/detail',array('id'=>$article['id']));?>"><?php echo ($article['title']); ?></a></span>
                                        </h3>

                                        <p class="text-muted">
                                            <span><i class="icon-pushpin"></i></span>
                                            <span><a href="<?php echo U('Sort/detail',array('id'=>$article['sort_id']));?>"><?php echo ($article['sort']); ?></a></span>
                                            <span>|</span>
                                            <span><a href="<?php echo U('User/info',array('id'=>$article['author_id']));?>"><?php echo ($article['author']); ?></a></span>
                                            <span>|</span>
                                            <span><?php echo ($article['create_time']); ?></span>
                                            <span>|</span>
                                            <span>
                                                <?php if(($article['last_comment'] != null)): ?>最后回复:<?php echo ($article['last_comment']); ?>
                                                    By <a href="<?php echo U('User/info',array('id'=>$article['last_comment_user_id']));?>"><?php echo ($article['last_comment_user_name']); ?></a>
                                                    <?php else: ?>
                                                    暂无回复<?php endif; ?>
                                            </span>
                                        </p>
                                    </div>
                                </li><?php endforeach; endif; ?>
                        </ul>
                    </div>
                </div>


            </div>

            <div class="col-md-4  hidden-xs">

                <div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title"><b>BBS论坛</b></h3>
    </div>
    <div class="panel-body">
        论坛介绍
    </div>
</div>
                <!--<div class="panel panel-default">-->
                    <!--<div class="panel-heading">-->
                        <!--<h3 class="panel-title">活跃会员</h3>-->
                    <!--</div>-->
                    <!--<div class="panel-body">-->
                        <!--<div class="media list-group photos-rows">-->
                            <!--<div class="col-md-1 photo-rows">-->
                                <!--<a class="" href="#">-->
                                    <!--<img src="images/2016_07_22_18.png" alt="作者">-->
                                <!--</a>-->
                            <!--</div>-->

                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
                <!--&lt;!&ndash;&ndash;&gt;-->
                <!--<div class="panel panel-default">-->
                    <!--<div class="panel-heading">-->
                        <!--<h3 class="panel-title">最新会员</h3>-->
                    <!--</div>-->
                    <!--<div class="panel-body">-->
                        <!--<div class="media list-group photos-rows">-->
                            <!--<div class="col-md-1 photo-rows">-->
                                <!--<a class="" href="#">-->
                                    <!--<img src="images/2016_07_22_18.png" alt="作者">-->
                                <!--</a>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->

                <?php if($_SESSION['uid']== null): ?><div class="panel panel-default">
    <div class="panel-heading">
        <h4><b>还没登陆？</b></h4>
    </div>
    <div class="panel-body">
        <a href="#" class="btn btn-default">现在注册</a> 已注册请
        <a href="<?php echo U('user/login');?>" class="">登入</a>
    </div>
</div><?php endif; ?>
                <div class="panel panel-default ">
    <div class="panel-heading">
        <h4><b>广告位</b></h4>
    </div>
    <div class="panel-body">
        <a href="#" class="">广告位</a>
    </div>
</div>
                <!---->

            </div>

        </div>
    </div>

</div>

<!---->
</div>
<!---->
<footer id="footer">
    <div class="container">
        <p>Powered by BBS 2016-2017 Allright rights reserved</p>
    </div>
</footer>
<!---->
<script src="/tp/Public/js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
<script src="/tp/Public/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
</body>

</html>